jun.sidebar = new jun.TreeUi({
    dataUrl: 'home/tree'
});
jun.sidebar.on('click', function(node, e) {
    if (node.isLeaf()) {
        e.stopEvent();
        if (node.id == 'logout') {
            Ext.MessageBox.confirm('Pertanyaan', 'Apakah anda yakin ingin logout?', function(btn) {
                if (btn == 'no')
                    return;
                window.location.href = 'Auth/logout';
            }, this);
        }else{
        jun.mainPanel.loadClass(node.id);
    }}
});
var clock = new Ext.Toolbar.TextItem('Jam');
jun.mainPanel = new jun.TabsUi();
jun.ViewportUi = Ext.extend(Ext.Viewport, {
    layout: 'border',
    initComponent: function() {
        this.items = [
            {
                xtype: 'box',
                region: 'north',
                id: 'app-header',
                html: 'Sistem Informasi Hineni<br />' +
                        '<span class="subtitle">Yogyakarta</span>',
                height: 60
            },
            jun.sidebar,
            jun.mainPanel,
        ];
        jun.ViewportUi.superclass.initComponent.call(this);
    }
});
Ext.onReady(function() {
    var hideMask = function() {
        Ext.get('loading').remove();
        Ext.fly('loading-mask').fadeOut({
            remove: true
                    
        });
    }
    Ext.QuickTips.init();
    loadText = 'Sedang proses... silahkan tunggu';
    Ext.Ajax.on('beforerequest', function() {
        Ext.getBody().mask(loadText, 'x-mask-loading', true);
    }, Ext.getBody());
    Ext.Ajax.on('requestcomplete', Ext.getBody().unmask, Ext.getBody());
    Ext.Ajax.on('requestexception', Ext.getBody().unmask, Ext.getBody());
    var myViewport = new jun.ViewportUi({
    });
});
